<?php
load_info_var($cf_action);	   //加载smarty变量
$id = isset($_POST['id']) ? intval($_POST['id']) : intval($_GET['id']);
$type = isset($_POST['type']) ? intval($_POST['type']) : intval($_GET['type']);
$self = isset($_POST['self']) ? intval($_POST['self']) : intval($_GET['self']);
$return_page = $cf_pre_page ? $cf_pre_page : $cf_self_page;
require_once(INFO_PATH.'cf_var_area.php');
$templeate = 'detail';
$smarty->mypage($templeate, $cf_action, 0);
switch ($cf_action) {   
	case "user":
		load_file('user_class', LIB_PATH);
		$main = new User($db);
		$username = trim($_GET['username']);
		if($username){			
			$row = $main->get_user_info('*',"user_name='".$username."'");
			//dump($row);
			if(!$row){
				my_error('没有搜索到相关信息');
			}
			
		}else{
			//$db->debug(1,1);
			$row = $main->get_data_row($id);		
		}		
				
	break; 
	case "rebate":
		load_file('order_class', LIB_PATH);
		load_file('goods_class', LIB_PATH);
		load_file('user_class', LIB_PATH);
		$main = new Order($db);
		$row = $main->get_data_row($id);
		$goods = new Goods($db);
		$user = new User($db);
		$goods_row = $goods->get_data_row($row['order_goods_id'],'goods_index_photo,goods_cate');//商品信息
		$user_row = $user->get_data_row($row['order_uid'],'user_bank,user_bank_code,user_bank_name');//用户信息		
		$row['goods_index_photo'] = $goods_row['goods_index_photo'];
		$row['goods_cate'] = $goods_row['goods_cate'];
		$row['user_bank'] = $user_row['user_bank'];
		$row['user_bank_code'] = $user_row['user_bank_code'];
		$row['user_bank_name'] = $user_row['user_bank_name'];
		
	break;
	case "suggestion": //建议/投诉
		load_file('suggestion_class', LIB_PATH);
		$suggestion = new Suggestion($db);
		$row = $suggestion->get_data_row($id);				
	break;	


	case "sp":								//商家
		load_file('sp_class', LIB_PATH);
		$main = new Sp($db);
		$row = $main->get_data_row($id);
		//dump($row);			
	break;
	case "apply":								//商家申请
		load_file('sp_class', LIB_PATH);
		$main = new Sp($db);
		$row = $main->get_data_row($id);
		//dump($row);			
	break;
	default:
	my_jump('非法操作!');
	break;
}

	
$smarty->assign(array(
    'id' => $id,
	'type' => $type,
    'row' => $row,
    'data' => $data,
    'data1' => $data1,
    'sessionid' => session_id(),
    'page' => $page,

));


$smarty->mydisplay();
?>